package com.rdgk.newtech.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.rdgk.newtech.dao.ArticleDao;
import com.rdgk.newtech.dao.ParametersDao;
import com.rdgk.newtech.service.ParametersService;
import com.rdgk.newtech.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.rdgk.newtech.dao.LogManagementDao;
import com.rdgk.newtech.service.LogManagementService;

import java.util.List;

/**
 * @author: zandaoguang
 */
@Service
public class LogManagementServiceImpl implements LogManagementService{

    @Autowired
    private LogManagementDao logmanagementDao;
    /**
     * 新增文章
     */


    @Override
    public JSONObject listlog(JSONObject jsonObject) {
//		System.out.println("yyyyyyyyyyyyyyyyyyyyyy");
        CommonUtil.fillPageParam(jsonObject);
        System.out.println("jsonObject:"+jsonObject);
//		System.out.println("uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu");
        int count = logmanagementDao.countlog(jsonObject);
        List<JSONObject> list = logmanagementDao.listlog(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public JSONObject deletelog(JSONObject jsonObject) {
        logmanagementDao.deletelog(jsonObject);
        return CommonUtil.successJson();
    }

    @Override
    public JSONObject listlogbysearch(JSONObject jsonObject) {
        System.out.println("我是昝道广！！！！！");
        CommonUtil.fillPageParam(jsonObject);
        System.out.println("jsonObject:"+jsonObject);
        int count = logmanagementDao.countlogbysearch(jsonObject);
        System.out.println("count:"+count);
        List<JSONObject> list = logmanagementDao.listlogbysearch(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 当搜索文章的时候，也就是有搜索内容的时候，排序只能排序搜索内容，不能排序全部
     */



}
